/*
 * @Author: heinan
 * @Date: 2023-08-03 10:07:39
 * @Last Modified by: heinan
 * @Last Modified time: 2023-08-03 10:25:02
 */
"use strict";
const { Service } = require("egg");
const { idCreator } = require("../utils");

class ArticelService extends Service {
  async index(id) {
    return await this.app.mysql.get("articel", { articel_id: id });
  }
  async create({ articel_id, articel_text }) {
    const $data = {
      articel_text,
      articel_id,
    };
    return await this.app.mysql.insert("articel", $data);
  }
  async destroy({ id }) {
    return await this.app.mysql.delete("articel", { articel_id: id });
  }
  async update({ id, articel_text }) {
    const $data = { articel_id: id, articel_text };
    return await this.app.mysql.update("articel", $data);
  }
}

module.exports = ArticelService;
